package leetcode;

/**
 * @author:xufengxiang
 * @date 2023-02-20 20:51
 */
public class Code9 {
    public boolean isPalindrome(int x) {
        if(x <0 || (x%10 ==0 && x!=0)){
            return false;
        }
        if(x < 10){
            return true;
        }

        int revert = 0;

        while(x > revert){
            revert = revert * 10 + x %10;
            x = x / 10;
            if( x == revert || x/10 == revert){
                return true;
            }
        }
        return false;
    }
}
